/**
 * @param {number[]} mapping
 * @param {number[]} nums
 * @return {number[]}
 */
 var sortJumbled = function(mapping, nums) {
  const mp = new Map()
  for(let x of nums) {
    let arr = String(x).split('').map(v => Number(v))
    for(let i = 0; i<arr.length; i++) {
      arr[i] = mapping[arr[i]]
    }
    mp.set(x, Number(arr.join('')))
  }
  return nums.sort((a,b) => mp.get(a)-mp.get(b))
};